<template>
  <div>
    <div class="banner" :style="back">
      <ul class="banner_in banxin">
        <li v-for="(item, index) in banner" :key="index">
          <img
            :src="item.imageUrl"
            alt=""
            :class="num == index ? 'active' : 'hidden'"
          />
        </li>
        <div class="pre common" @click="add">&lt;</div>
        <div class="next common" @click="sub">&gt;</div>
      </ul>
    </div>
    <div class="index banxin tanxin">
      <div class="indexl">
        <div class="hot">
          <div class="titles">
            <i class="iconfont icon-tongzhi"></i>
            <div class="title">热门推荐</div>
            <ul class="tab tanxin">
              <li><a href="javascript:;">华语</a></li>
              <li><a href="javascript:;">流行</a></li>
              <li><a href="javascript:;">摇滚</a></li>
              <li><a href="javascript:;">民谣</a></li>
              <li><a href="javascript:;" class="last">电子</a></li>
            </ul>
            <div class="more">
              <span>更多</span
              ><i class="iconfont icon-a-youjiantouzhixiangyoujiantou"></i>
            </div>
          </div>
          <ul class="lists tanxin">
            <li v-for="(item, index) in Hotsong" :key="index">
              <img :src="item.picUrl" alt="" />
              <p>{{ item.name }}</p>
            </li>
          </ul>
        </div>
        <div class="news">
          <div class="titles">
            <i class="iconfont icon-tongzhi"></i>
            <div class="title">新碟上架</div>
            <div class="more">
              <span>更多</span
              ><i class="iconfont icon-a-youjiantouzhixiangyoujiantou"></i>
            </div>
          </div>
          <div class="newsbox">
            <div class="pres commons" >&lt;</div>
            <div class="nexts commons">&gt;</div>
            <ul class="newslists tanxin">
              <li v-for="(item, index) in Newsong" :key="index">
                <img :src="item.picUrl" alt="" />
                <p>{{ item.name }}</p>
                <p>{{ item.artists[0].name }}</p>
              </li>
            </ul>
          </div>
        </div>
        <div class="ph">
          <div class="titles">
            <i class="iconfont icon-tongzhi"></i>
            <div class="title">榜单</div>
            <div class="more">
              <span>更多</span
              ><i class="iconfont icon-a-youjiantouzhixiangyoujiantou"></i>
            </div>
          </div>
         <div class="phbox tanxin">
            <div class="phbox1">
              <div class="phtop">
                 
              </div>
              <ul class="phlist">
                   <li></li>
                   <li></li>
                   <li></li>
                   <li></li>
                   <li></li>
                   <li></li>
                   <li></li>
                   <li></li>
                   <li></li>
                   <li></li>
                 </ul>
              <div class="phfoot">

              </div>
            </div>
            <!-- <div class="phbox2">
              
            </div>
            <div class="phbox3"></div> -->
         </div>
        </div>
      </div>
      <div class="indexr">
        <div class="login">
          <p>登录网易云音乐，可以享受无限收藏的</p>
          <p>乐趣，并且无限同步到手机</p>
          <button>用户登录</button>
        </div>
        <div class="detail">
          <!-- 入驻歌手 -->
          <p class="Subheading">
            <span>入驻歌手</span>
            <span>《查看全部》</span>
          </p>
          <!-- 歌曲展示 -->
          <ul>
            <li v-for="(item,index) in SongerArr" :key="index">
              <span
                ><img
                  :src="item.img1v1Url"
                  alt=""
                  width="62px"
                  height="62px"
              /></span>
              <span>
                <h3>{{item.name}}</h3>
                <p></p>
              </span>
            </li>
          </ul>
          <button>申请成为网易音乐人</button>
          <p class="Sub">
            <span>热门主播</span>
          </p>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { BannerApi, HotApi, NewApi,SongerApi} from "../request/api";
export default {
  data() {
    return {
      banner: "",
      num: 7,
      back: "background:rgb(109, 71, 66)",
      Hotsong: "",
      Newsong: "",
      Bd:'',
      SongerArr:''
    };
  },
  created() {
    BannerApi().then((res) => {
      console.log(res);
      this.banner = res.data.banners;
      setInterval(() => {
        if (this.num > 0) {
          this.num--;
        } else if (this.num == 0) {
          this.num = 7;
        }
        // console.log(this.num);
      }, 3000);
    });
    HotApi().then((res) => {
      console.log(res);
      this.Hotsong = res.data.result;
    });
    NewApi().then((res) => {
      console.log(res);
      this.Newsong = res.data.albums;
    });
    SongerApi().then((res)=>{
      console.log(res);
    
      this.SongerArr=res.data.artists

    })
   
   
  },
  methods: {
    add() {
      if (this.num < 7) {
        this.num++;
      } else if (this.num == 7) {
        this.num = 0;
      }
    },
    sub() {
      if (this.num > 0) {
        this.num--;
      } else if (this.num == 0) {
        this.num = 7;
      }
    },
  
    
  },
};
</script>
 
<style lang = "less" scoped>
@import "../assets/base";

.banner {
  height: 284px;

  ul {
    height: 284px;
    position: relative;
    .common {
      width: 30px;
      height: 60px;
      border: 1px solid #ccc;
      text-align: center;
      line-height: 60px;
      font-size: 30px;
      background-color: rgba(190, 188, 186, 0.5);
      border-radius: 10px;
      position: absolute;
      cursor: pointer;
    }
    .pre {
      left: 10%;
      top: 50%;
      transform: translateY(-50%);
    }
    .next {
      right: 10%;
      top: 50%;
      transform: translateY(-50%);
    }
    li {
      width: 740px;
      position: absolute;
      left: 0;
      right: 0;
      top: 0;
      bottom: 0;
      margin: auto;
      img {
        width: 740px;
        position: absolute;

        &.active {
          z-index: 9;
          animation: identifier 1s linear;
        }
      }
    }
  }
}
@keyframes identifier {
  0% {
    opacity: 0.8;
  }
  100% {
    opacity: 1;
  }
}
.index {
  border: 1px solid #ccc;
  box-sizing: border-box;
  width: 980px;
  /* height: 1000px; */
  .indexl {
    width: 689px;
    padding: 20px;
    /* background-color: pink; */
    .hot {
      height: 523px;
      /* background-color: wheat; */
      margin-bottom: 50px;
      .titles {
        display: flex;
        height: 30px;
        line-height: 30px;
        position: relative;
        border-bottom: 2px solid rgb(190, 7, 7);
        margin-bottom: 20px;
        i {
          color: red;
        }
        .title {
          font-size: 20px;
          padding: 0 20px 0 10px;
          cursor: pointer;
        }
        .tab {
          li {
            a {
              height: 14px;
              font-size: 14px;
              padding: 0 10px;
              border-right: 1px solid #ccc;
              color: #666;
              &.last {
                border-right: 0;
              }
            }
          }
        }
        .more {
          position: absolute;
          right: 0;
          span {
            margin-right: 10px;
            cursor: pointer;
          }
          i {
            cursor: pointer;
            margin-right: 5px;
          }
        }
      }
      .lists {
        width: 100%;
        height: 470px;
        flex-wrap: wrap;
        overflow: hidden;
        li {
          width: 160px;
          height: 234px;
          /* background-color: skyblue; */
          margin-bottom: 15px;
          img {
            width: 100%;
          }
        }
      }
    }
    .news {
       margin-bottom: 50px;
      .titles {
        display: flex;
        height: 30px;
        line-height: 30px;
        position: relative;
        border-bottom: 2px solid rgb(190, 7, 7);
        margin-bottom: 20px;
        i {
          color: red;
        }
        .title {
          font-size: 20px;
          padding: 0 20px 0 10px;
          cursor: pointer;
        }

        .more {
          position: absolute;
          right: 0;
          span {
            margin-right: 10px;
            cursor: pointer;
          }
          i {
            cursor: pointer;
            margin-right: 5px;
          }
        }
      }
      .newsbox {
        width: 100%;
        height: 205px;
        /* background-color: slateblue; */
        border: 1px solid #ccc;
        position: relative;
        overflow: hidden;
        .commons {
          position: absolute;
          cursor: pointer;
        }
        .pres {
          left: 10px;
          top: 50%;
          transform: translateY(-50%);
        }
        .nexts {
          right: 10px;
          top: 50%;
          transform: translateY(-50%);
        }
       
        .newslists {
          width: 2000px;
          height: 100%;
          /* background-color: springgreen; */
          margin: 0 auto;
          /* flex-wrap: wrap; */
          display: flex;
          /* overflow: hidden; */
          li {
            width: 130px;
            height: 150px;
            /* background-color: tan; */
            margin-top: 30px;
            margin-left: 30px;
            img {
              width: 100%;
            }
            p {
              text-align: center;
            }
          }
        }
      }
    }
    .ph{
      .titles {
        display: flex;
        height: 30px;
        line-height: 30px;
        position: relative;
        border-bottom: 2px solid rgb(190, 7, 7);
        margin-bottom: 20px;
        i {
          color: red;
        }
        .title {
          font-size: 20px;
          padding: 0 20px 0 10px;
          cursor: pointer;
        }

        .more {
          position: absolute;
          right: 0;
          span {
            margin-right: 10px;
            cursor: pointer;
          }
          i {
            cursor: pointer;
            margin-right: 5px;
          }
        }
      }
      .phbox{
        height: 470px;
        background-color: pink;
        border: 1px solid #ccc;
        .phbox1{
          background-color: #ccc;
          
          width: 33.33%;
          height: 100%;
          border-right: 1px solid #eee;
          box-sizing: border-box;
          .phtop{
            width: 100%;
            height: 120px;
            background-color: gray;
          }
          .phlist{
            width: 100%;
            height: 300px;
            background-color: green;
              li{
                width: 100%;
                height: 10%;
                background-color: #eee;
                &:nth-child(even){
                  background-color: #ccc;
                }
              }
          }
            
          .phfoot{
            width: 100%;
            background-color: greenyellow;
            height: 50px;
          }
        }
        /* .phbox2{
          flex: 1;
           border-right: 1px solid #eee;
            box-sizing: border-box;
        }
        .phbox3{
          flex: 1;
        } */
      }
    }
  }
  .indexr {
    width: 250px;
    background-color: #eee;

    .login {
      width: 250px;
      height: 130px;
      text-align: center;
      background-image: linear-gradient(to bottom, #fff, #ccc);
      font-size: 8px;
      padding-top: 20px;
      box-sizing: border-box;
      border: 1px solid #999;
      &:hover {
        background-image: linear-gradient(to bottom, #999, #000);
      }
      p {
        margin-bottom: 5px;
      }
      button {
        background-color: red;
        border: none;
        width: 100px;
        height: 31px;
        border-radius: 20px;
        color: #fff;
      }
      button:hover {
        border: 2px solid rgb(245, 245, 245);
        cursor: pointer;
      }
    }
  }
  .detail {
    width: 250px;
   
    background-color: #fff;
    border: 1px solid #ccc;
    float: right;
  
    
    padding: 10px 10px;
    box-sizing: border-box;
    cursor: pointer;
    p {
      span:nth-of-type(1) {
        margin-right: 88px;
      }
      
      padding-bottom: 10px;
      border-bottom: 1px solid #ccc;
    }
    ul {
      list-style: none;
      li {
        display: flex;
        border: 1px solid #ccc;
        span:nth-of-type(2) {
          margin-left: 10px;
        }
      }
    }
    text-align: center;
    button {
      margin-top: 20px;
      margin-bottom: 30px;
      width: 100%;
      height: 31px;
      line-height: 31px;
      border: 1px solid #ccc;
      border-radius: 5px;
      background-image: linear-gradient(to top, #fff, #ccc);
      &:hover {
        background-image: linear-gradient(to top, #999, #fff);
        opacity: 0.6;
        transition: 0.3s;
      }
    }
    .Sub {
      span {
        margin-left: -60px;
      }
    }
  }
}
</style>